Repository navigation
fix(cli): refuse OpenCode 1.x before managed account login - #35956
Alonsojrr14 wants to merge 2 commits into
Conversation
`orca account add --agent opencode` always ran `opencode auth login --standalone`. OpenCode 1.x has no `--standalone`, so it printed its help and exited 1 with no hint about why. Probe `opencode auth login --help` first and explain that managed OpenCode accounts need OpenCode 2. Fixes stablyai#35953 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q9uoqirRAeE1XCUTzQTV47
|
After opening this I found something that makes me think it may only treat the symptom, so I'd like to check the intended behavior before going further.
But Questions:
Depending on the answer, I can change this PR to resolve |
[Medium impact] The PR appears safe to merge; the previous finding is fixed and no new actionable issues remain. SummaryAdds a help check before managed OpenCode login and rejects installations without
Reviews (2) · Last reviewed commit: "fix(cli): treat a failed OpenCode help p..." · Reviewed by Greptile |
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4dc2e0fa-cf61-4c92-92ff-a24583757ee7
Files selected for processing: 3-
src/cli/handlers/account.tssrc/cli/handlers/data-account-commands.test.tssrc/cli/handlers/data-account-commands.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
A launcher that starts but exits nonzero printed an error without `--standalone`, which was reported as OpenCode 1.x. OpenCode 1.x exits 0 on `auth login --help`, so it is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q9uoqirRAeE1XCUTzQTV47
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Major · Use the OpenCode 2 command for both enrollment operations. · account.ts:281
src/cli/handlers/account.ts:281
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftUse the OpenCode 2 command for both enrollment operations.
addDataAccountprobesopencodeand later starts login with the same hard-coded executable. A supported installation that providesopencode2therefore receives an inconclusive probe result and then attempts to launch the missingopencodecommand.Resolve the OpenCode 2 executable once and use it for both the help probe and login. Keep
opencodeas the backend provider key foraccounts.addDataFromHome.

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
56b92270-caf5-470c-adc7-5c3983559096
Files selected for processing: 1-
src/cli/handlers/account.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
|
Superseded by #36292, which landed the fix (resolving |
ELI5
Adding an OpenCode account in Orca only works with OpenCode 2. With OpenCode 1.x installed, Orca crashed into OpenCode's help screen and gave no reason. Now Orca checks first and says what's wrong.
What Changed
Before:
orca account add --agent opencodealways ranopencode auth login --standalone. OpenCode 1.x (the currentlateston npm, 1.19.5) has no--standalone, so it printed its help and the command failed with`opencode auth login --standalone` exited with code 1.After: before starting the login, the CLI runs
opencode auth login --help. If the output has no--standalone, it stops with:Mechanism:
addDataAccounttakes areadLoginHelpprobe next to the existinglogincallback.account.tsimplements it with the same command resolution, Windows batch spawn args and PATH setup asrunAgentLoginInTerminal. If the probe can't run at all, it returnsnulland the login goes ahead as before, so a missing binary still gets the existing "Is it installed and on PATH?" error.Why
Just dropping
--standalonefor 1.x would not work: the account capture reads OpenCode 2's isolated credential database, so the login would succeed and the import would fail later with a less clear error. Checking the help output instead of--versionalso works for the0.0.0-beta-*/0.0.0-dev-*builds on npm, whose version numbers say nothing about the major.Linked Issue
Fixes #35953
Visual Proof
N/A: CLI-only change, no UI. The before and after terminal output is quoted above.
Testing
vitestonsrc/cli/handlers/data-account-commands.test.tsandsrc/cli/handlers/account*: 39 passed, including the new "refuses OpenCode 1.x before starting login" case.oxlinton the changed files and the CLI typecheck project (config/tsconfig.tc.cli.json) pass.On macOS (arm64) with
opencode-ai@1.19.5, I ran the same resolution and probe code against the real binary: it resolved/usr/local/bin/opencode, read the help, and found no--standalone.Not tested on Linux, Windows or over SSH. The probe reuses the existing cross-platform spawn helpers, and
account addalready rejects remote selection flags.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Written with Claude Code (Claude Opus 5.5). I reviewed the change and the test results.
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code
https://claude.ai/code/session_01Q9uoqirRAeE1XCUTzQTV47